<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>vue 04</title>
    <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>

<body>
    <div id="app">{{msg}}</div>
    <script text="text/javascript">
        var data = { msg: "this is msg" };
        var vm = new Vue({
            el: '#app',
            data: data,
            beforeCreate: function () {
                console.log("beforeCreate");
            },
            created() {
                console.log("created");
            },
            beforeMount() {
                console.log("beforeMount");
            },
            mounted() {
                console.log("mounted");
            },
            beforeUpdate() {
                console.log("beforeUpdate");
            },
            updated() {
                console.log("updated");
            },

        });
        vm.$watch("msg", (newValue, oldValue) => {
            console.log(newValue, oldValue);
        });

        setTimeout(() => {
            vm.msg = "change ....";
        }, 2000);
    </script>
</body>